package crivia.eca.carry;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import crivia.db.a.DataSet_AR;

import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.soa.workflow.request.Cell;
import weaver.soa.workflow.request.DetailTable;
import weaver.soa.workflow.request.Row;

public class DataSet_Ecology_Row extends DataSet_AR {
	
	public DataSet_Ecology_Row(RecordSet tRS, List<String> keys){
		while (tRS.next()){
			Map<String, String>tM = new HashMap<String, String>();
			for (String k : keys){
				tM.put(k.toLowerCase(), tRS.getString(k));
				_keys.add(k);
			}
			datas.add(tM);
		}
	}
	
	public DataSet_Ecology_Row(RecordSet tRS, String... keys){
		while (tRS.next()){
			Map<String, String>tM = new HashMap<String, String>();
			for (String k : keys){
				tM.put(k.toLowerCase(), tRS.getString(k));
				_keys.add(k);
			}
			datas.add(tM);
		}
	}
	
	public DataSet_Ecology_Row(RecordSetTrans tRS, String... keys){
		while (tRS.next()){
			Map<String, String>tM = new HashMap<String, String>();
			for (String k : keys){
				tM.put(k.toLowerCase(), tRS.getString(k));
				_keys.add(k);
			}
			datas.add(tM);
		}
	}
	
	public DataSet_Ecology_Row(DetailTable subTable){
		for (Row row : subTable.getRow()){
			Map<String, String>tM = new HashMap<String, String>();
			for (Cell cell : row.getCell()){
				tM.put(cell.getName().toLowerCase(), cell.getValue());
				_keys.add(cell.getName().toLowerCase());
			}
			tM.put("id", row.getId());
			datas.add(tM);
		}
	}

}
